<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix"><span>悬浮按钮</span></div>
    <div>
      <el-collapse v-model="activeNames">
        <el-collapse-item title="组件状态" name="1">
          <el-form size="medium" label-width="100px">
            <el-form-item label="按钮图片">
              <div class="img_box"><Upload :tempUrl="data.img" @input="getimg"></Upload></div>


              </el-form-item>
            <el-form-item label="按钮宽度">
              <div class="slider_box">
                <el-slider class="slider_item" :max="150" :min="10" v-model="data.width"></el-slider>
                <el-input-number v-model="data.width" :controls="false" :min="10" :max="150"></el-input-number>
              </div>
            </el-form-item>
            <el-form-item label="选择链接">
              <div @click="selectlink(data.link)" class="link_div"><Linkdiv :linkdata="data.link"></Linkdiv></div>
            </el-form-item>
            <el-form-item label="按钮位置">
              <el-radio-group v-model="data.position">
                <el-radio label="lt">左上</el-radio>
                <el-radio label="rt">右上</el-radio>
                <el-radio label="lb">左下</el-radio>
                <el-radio label="rb">右下</el-radio>
              </el-radio-group>
              <div class="input_content">

            <el-form>
              <el-form-item label="上下偏移">
                <div class="slider_box">
                  <el-slider class="slider_item" :max="200" v-model="data.deviationa"></el-slider>
                  <el-input-number v-model="data.deviationa" :controls="false" :min="0" :max="200"></el-input-number>
                </div>
              </el-form-item>
              <el-form-item label="左右偏移">
                <div class="slider_box">
                  <el-slider class="slider_item" :max="150" v-model="data.deviationb"></el-slider>
                  <el-input-number v-model="data.deviationb" :controls="false" :min="0" :max="150"></el-input-number>
                </div>
              </el-form-item>
            </el-form>

              </div>
            </el-form-item>
          </el-form>
        </el-collapse-item>
      </el-collapse>
    </div>
  </el-card>
</template>

<script>
import Upload from '@/components/Upload/SingleImage2';
import Linkdiv from '@/components/Link/index';
export default {
  props: {
    data: {
      type: Object,
      default: {}
    },

  },
  data(){
    return {
      activeNames:['1']
    }
  },
  components: {
    Upload,
    Linkdiv
  },
  methods: {
    getimg(img) {
      let _this = this;
      this.data.img = img;

    },
    selectlink(item) {
      this.$parent.showlinkselcet(item);
    },
    getAData(item) {
      this.data.link = item;
    }
  }
};
</script>

<style>
  .link_div{
    width: 100%;
  }
.img_box{
  width: 60px;
  height: 60px;
  display: flex;
}
</style>
